package com.yunfeng.supercall.manager;

import android.content.Context;
import android.content.SharedPreferences;

public class CommentCountManager {

	private CommentCountManager(Context context) {
		mPreferences = context.getSharedPreferences("sharecomment",
				Context.MODE_PRIVATE);
	}

	private static CommentCountManager sCommentCountManager;

	public static CommentCountManager getInstance(Context context) {
		synchronized (CommentCountManager.class) {
			if (sCommentCountManager == null) {
				sCommentCountManager = new CommentCountManager(
						context.getApplicationContext());
			}
			return sCommentCountManager;
		}
	}

	private SharedPreferences mPreferences;

	public int getMaxId() {
		int count = mPreferences.getInt("maxid", 0);
		return count;
	}

	public int getCurrentId() {
		int count = mPreferences.getInt("current", 0);
		return count;
	}

	public void setMaxId(int id) {
		mPreferences.edit().putInt("maxid", id).commit();
	}

	public void setCurrentId(int id) {
		mPreferences.edit().putInt("current", id).commit();
	}
}
